<template>
    <div class="card">
        <!-- {{this.cardData}} -->
        <div class="block">
            <div v-if="this.cardData == ''" class="noEquipment"> 
                该项绑定设备未开启
            </div>
            <el-carousel trigger="click" class="card_hight" :autoplay="false" :initial-index="cardData.index" >
            <el-carousel-item v-for="item in cardData.unit" :key="item.index">
                <!-- 设备标题 -->
                <router-link to="/overview">
                    <h4 class="normal" @click="router('cleantable',item)" :title="item.name">
                    <!-- <svg class="icon card_icon" aria-hidden="true">
                        <use xlink:href="#icon-xinfeng-copy"></use>
                    </svg> -->
                    <img class="title_icon" src="../../assets/title.png" alt />
                    {{item.typename}}:&nbsp;{{item.name}}
                 </h4>
                </router-link>
                <!-- 卡片内容 -->
                <div class="card_padding">
                    <div class="clean_table_bottom">
                        <div class="clean_table_bottom_l">
                            <div class="clean_table_pm">
                               <div class="clean_table_pm_zt" style="color:#38bdea" v-if="item.unit[5].value == 17">强效净化</div>
                               <div class="clean_table_pm_zt" style="color:#38bdea" v-if="item.unit[5].value == 33">快速净化</div>
                               <div class="clean_table_pm_zt" style="color:#bbbbbb; line-height: 70px;" v-if="item.unit[5].value == 16 || item.unit[5].value == 0">待机</div>
                                <p>状态</p> 
                            </div>
                            
                        </div>
                        <div class="clean_table_bottom_r">
                            <div class="airclean_progress">
                                <p  class="airclean_progress_name">{{item.unit[2].name}}:
                                </p>
                                <el-progress :show-text="false" :percentage="parseInt((item.unit[2].value/(item.unit[2].max-item.unit[2].min))*100 >= 100 ? 100 : (item.unit[2].value/(item.unit[2].max-item.unit[2].min))*100) || 0" :stroke-width="10" ></el-progress>
                                <p class="airclean_progress_val">{{item.unit[2].value.toFixed(0)}}
                                    <span>{{item.unit[2].flag}}</span>
                                </p>
                            </div>
                            <div class="airclean_progress">
                                <p  class="airclean_progress_name">{{item.unit[3].name}}: 
                                </p>
                                <el-progress :show-text="false" :percentage="parseInt((item.unit[3].value/(item.unit[3].max-item.unit[3].min))*100 >= 100 ? 100 : (item.unit[3].value/(item.unit[3].max-item.unit[3].min))*100) || 0" :stroke-width="10" ></el-progress>
                                <p class="airclean_progress_val">{{item.unit[3].value.toFixed(0)}}
                                    <span>{{item.unit[3].flag}}</span>
                                </p>
                            </div>
                            <div class="airclean_progress">
                                <p  class="airclean_progress_name">{{item.unit[0].name}}:
                                </p>
                                <el-progress :show-text="false" :percentage="parseInt((item.unit[0].value/(item.unit[0].max-item.unit[0].min))*100 >= 100 ? 100 : (item.unit[0].value/(item.unit[0].max-item.unit[0].min))*100) || 0" :stroke-width="10" ></el-progress>
                                <p class="airclean_progress_val">{{item.unit[0].value.toFixed(0)}}
                                    <span>{{item.unit[0].flag}}</span>
                                </p>
                            </div>
                            <div class="airclean_progress">
                                <p  class="airclean_progress_name">{{item.unit[1].name}}:
                                </p>
                                <el-progress :show-text="false" :percentage="parseInt((item.unit[1].value/(item.unit[1].max-item.unit[1].min))*100 >= 100 ? 100 : (item.unit[1].value/(item.unit[1].max-item.unit[1].min))*100) || 0" :stroke-width="10" ></el-progress>
                                <p class="airclean_progress_val">{{item.unit[1].value.toFixed(0)}}
                                    <span>{{item.unit[1].flag}}</span>
                                </p>
                            </div>
                        </div>
                    </div>
                    <div style="padding-right:20px">
                        <div class="clean_table box">
                            <div class="clean_table_left">
                                <p>工作状态：</p>
                                <p class="clean_table_jh" style="color:#38bdea" v-if="item.unit[7].value == 1 && item.unit[4].value == 0">高速除尘</p>
                                <p class="clean_table_jh" style="color:#38bdea" v-if="item.unit[7].value == 1 && item.unit[4].value == 1">低速除尘</p>
                                <p class="clean_table_jh" style="color:#bbbbbb" v-if="item.unit[7].value == 0">待机</p>
                            </div>
                            <div class="clean_table_left">
                                <p>工作模式：</p>
                                <p class="clean_table_ms" style="color:#bbbbbb" v-if="item.unit[7].value == 0">待机</p>
                                <p class="clean_table_ms" v-if="item.unit[7].value == 1 && item.unit[6].value == 0">手动模式</p>
                                <p class="clean_table_ms" v-if="item.unit[7].value == 1 && item.unit[6].value == 1">自动模式</p>
                                <p class="clean_table_ms" v-if="item.unit[7].value == 1 && item.unit[6].value == 2">感应模式</p>
                            </div>
                        </div>
                    </div>
                </div>
                 
            </el-carousel-item>
            </el-carousel>
        </div>
        
    </div>
</template>

<script>
export default {
    props: ['nowIndex', 'cardData', 'nowId'],
    data () {
        return{
        }
    },
    created() {
    },
    methods: {
        // 跳转
        router(val,item){
            var arr = {
                addr:item.addr,
                name:item.name,
                type:item.type,
                uid:item.uid
            }
            localStorage.setItem("当前设备编号", JSON.stringify(arr))
            localStorage.setItem("menuRouter", val)
        },
    },
     // 清除定时器
    beforeDestroy() {
    },
}
</script>

<style scoped>

/deep/ .el-carousel__container .el-carousel__arrow {
    height: 150px !important;
    width: 110px !important;
    border-radius: 0;
    background: none;
}
/deep/ .el-icon-arrow-left {
    margin-left: -110px !important;
}
/deep/ .el-icon-arrow-right{
    margin-right: -110px !important;
}
/deep/ .el-carousel__indicators{
    display: none;
}
.normal .card_icon{
    font-size: 20px;
}
/deep/ .card_padding {
    padding: 0px 0px 0px 30px !important;
}
/* .card_padding_flex{
    display: flex;
}
.card_c{
    flex: 1;
}
.pm div{
    height: 90px;
    line-height: 90px;
}
.card_pm_name{
    width: 60px;
    text-align: right;
}
.card_pm_value{
    width: 90px;
    font-size: 24px;
    text-align: center;
}
.card_pm_flag{
    width: 50px;
}
.zt div{
    height: 65px;
    line-height: 65px;
}
.card_zt_name{
    width: 100px;
    padding-left: 10px;
} */
.clean_table {
    width: 400px;
    height: 70px;
    line-height: 70px;
    margin: 0px auto;
    position: relative;
    display: flex;
    text-align: center;
    align-items: center;
}
.clean_table_left{
    display: flex;
    flex: 1;
    justify-content: center;
}
.box {
    border: 1px solid #9ce0ffbd;
    background: linear-gradient(to top , rgba(255, 0, 0, 0), #8fc6ffa3 300%);
}

.box::after,
.box::before {
    width: 50px;
    height: 50px;
    content: "";
    position: absolute;
    transition: all 0.8s ease;
}

.box::before {
    top: -5px;
    left: -5px;
    border-top: 1px solid #9ce0ffbd;
    border-left: 1px solid #9ce0ffbd;
}

.box::after {
    right: -5px;
    bottom: -5px;
    border-bottom: 1px solid #9ce0ffbd;
    border-right: 1px solid #9ce0ffbd;
}
.clean_table_pm_zt{
        width: 55px;
    height: 70px;
    font-size: 18px;
    letter-spacing: 3px;
    line-height: 26px;
    margin-top: 15px;
    text-align: center;
    margin-left: 14px;
    font-weight: lighter;
}
.clean_table_jh,.clean_table_ms{
    font-size: 17px;
    font-weight: lighter;
}
.clean_table_ms{
    color: #facd86;
}
.clean_table_bottom{
    display: flex;
    position: relative;
    left: -5px;
}
.clean_table_bottom_l{
    width: 80px;
    text-align: center;
}  
.clean_table_bottom_r{
    margin-top: 5px;
    margin-left: 10px;
}
.airclean_progress{
    display: flex;
    margin-bottom: 12px;
}
.airclean_progress:first-child{
    margin-top: 5px;
}
.airclean_progress_name{
    width: 60px;
    overflow: hidden;
    line-height: 18px;
    position: relative;
    top: -3px;
}
/* .airclean_progress_val span{
    color: #acacac;
    font-size: 12px;
} */
.airclean_progress_val{
    width: 85px;
    overflow: hidden;
    line-height: 20px;
    color: #38bdea;
    font-size: 15px;
    white-space:nowrap
}
.airclean_progress_val span{
    font-size: 13px;
}
/deep/ .el-progress-bar__inner{
 background-color: transparent !important;
 background-image: linear-gradient(to right,#38bdea,#a8d5f6d9);
    background-size: 100% 100%;}
/deep/ .progress_title {
    /* display: inline-block; */
    width: 130px;
    line-height: 24px;
    float: left;
    /* flex: 1; */
    font-size: 16px;

}
/deep/ .el-progress{
    padding: 4px 0;
    padding-right: 10px;
    width: 195px;
    /* flex: 1; */
}
/deep/ .el-progress-bar__outer{
    background: none;
    border: .5px solid rgba(89, 129, 165, 0.8);
}
</style>